package apple.eclipse.actions;

import org.eclipse.ui.IWorkbenchWindow;

import apple.core.Apple;

public class ShutdownAction extends AbstractStatusAction {

   public static final String ID = "javapple2.shutdown";

   public ShutdownAction(IWorkbenchWindow window) {
      super(window);
      setId(ID);
      setText("&Shutdown");
      setToolTipText("Shutdown the emulator");
      setActionDefinitionId(ID);
   }

   protected boolean enablementCondition(Apple apple) {
      return apple.getStatus() == Apple.Status.RUNNING
            || apple.getStatus() == Apple.Status.SUSPENDED;
   }

   protected void runAction(Apple apple) {
      apple.shutdown();
   }
}
